﻿/**
 * Audio
 * 
 * @version 2012.01.27
 * @author  Bruno Miguel de Oliveira Tamer <bmotamer@gmail.com>
 */

#region XNA Libraries

using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Media;
using System;

#endregion

namespace main.sdk.audio
{

    public static class Audio
    {

        #region Static Variables

        private static Song BGM;

        #endregion

        #region Main Methods

        public static void PlayBGM(string assetName, byte volume = 100)
        {
            if (BGM != null)
                BGM.Dispose();
            if (assetName == null)
            {
                BGM = null;
                return;
            }
            BGM = Program.Self.Content.Load<Song>(assetName);
            MediaPlayer.Volume = volume / 100.0f;
            MediaPlayer.Play(BGM);
        }


        public static void PlaySE(string assetName, byte volume = 100, sbyte pitch = 0, sbyte pan = 0)
        {
            SoundEffect se = Program.Self.Content.Load<SoundEffect>(assetName);
            se.Play(volume / 100.0f, pitch / 100.0f, pan / 100.0f);
        }

        #endregion

    }

}